<?php

/**
 * photo actions.
 *
 * @package    sfwixet
 * @subpackage photo
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class aboutMeComponents extends sfComponents
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
	
  public function executeTitle(sfWebRequest $request)
  {
	
  }
  
  public function executeIndex(sfWebRequest $request)
  {
  		try{
  			if(is_numeric($request->getParameter("id"))){
	  			$profile = Doctrine::getTable("Profile")->find($request->getParameter("id"));
	  			if($profile instanceof Profile){
	  				$user = $profile->getUser();
	  				$this->interests = $profile->getInterests();
  					$this->photoId = $user->getMainPhotoId();
  					
  					$this->name = $user->getFirstName()." ".$user->getLastName();

	  			} else throw new Exception(__("Invalid ID"));
  			} else throw new Exception(__("No Id"));
  		}catch(AclException $e){
  			$this->interests = null;
  			$this->photoId = null;
  			$this->name = __("Permission denied");
  		}catch(Exception $e){
  			$this->interests = $this->getUser()->getProfile()->getInterests();
  			$this->photoId = $this->getUser()->getGuardUser()->getMainPhotoId();
  			$this->name = $this->getUser()->getGuardUser()->getFirstName()." ".$this->getUser()->getGuardUser()->getLastName();
  		}
  		

  }
}
